﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Resources;

namespace Earworm
{
    public partial class MainPage : UserControl
    {
        public int rating = 2;
        public int i = 0;

        public MainPage()
        {
            InitializeComponent();

        }

        private void SetAndStartClock(object sender, EventArgs e)
        {

            // The same for the second angle.
            double secangle = (rating - 5) * 36; ;

            // Same as with the hour animation.
            secondAnimation.From = secangle;
            secondAnimation.To = secangle + 36;

            // Start the storyboard.
 

        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {

                double secangle = (rating - 5) * 36; ;
                secondAnimation.From = secangle;
                secondAnimation.To = secangle + 36;
                rating = rating + 1;

                ClockEarWorm.Begin();

            if(rating > 4)
            {
                button1.IsEnabled = false;
            }
            if (rating >= 1)
            {
                button2.IsEnabled = true;
            }
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            double secangle = (rating - 5) * 36; ;
            secondAnimation.From = secangle;
            secondAnimation.To = secangle - 36;
            rating = rating - 1;

            ClockEarWorm.Begin();

            if (rating < 1)
            {
                button2.IsEnabled = false;
            }
            if (rating <= 4)
            {
                button1.IsEnabled = true;
            }
        }


    }

}
